<?php
/**
 * @version $Id$
 */
class KitmoneyAction extends BaseAction {
	protected $money;
	function _initialize() {
		parent::_initialize();
		self::exist_role(array(14,1));
		import ( 'Com.User' );
		import ( "ORG.Util.Input" );
		$this->user = new User ();
		$this->money = new KitMoney();
	}
	/**
	 * 显示用户的财务流水
	 */
	function index(){
		/*$totalRows=$this->money->assets($this->_userid,$this->_platform,'all','',$_REQUEST['changtype']);
		if ($totalRows > 0) {
			$page = new Page ( $totalRows, 10 );
			$pages=$page->show ();
			$list = $this->money->assets($this->_userid,$this->_platform,$page->firstRow . ',' . $page->listRows ,'',$_REQUEST['changtype']);
			$this->assign('list',$list);
			$this->assign('pages',$pages);
		}*/
		$this->display();
	}
	/**
	 * 查看分销商资金
	 * */
	function agentmoney(){
		$condition=array();
		
        $sfield= $_REQUEST['sfield'];
		if ($sfield != 'all' && !empty ($sfield) && !empty ($this->keywords)){
			$condition[$sfield] = $this->keywords;
		}
		//科目条件查询
		$subject= $_REQUEST['subject'];
		if (!empty($subject)&&$subject!='all'){
			$condition['subject'] = $subject;
		}
		$this -> assign($_REQUEST);
		$order=$this->orderField.' '.$this->orderDirection;
		$totalRows = $this->money->money_list($condition,'all');
		$this->assign ( "totalCount", $totalRows );
		if ($totalRows > 0) {
			$page = new Page ( $totalRows, $this->listrows );
			$pages=$page->show ();
			$list = $this->money->money_list($condition,$page->firstRow . ',' . $page->listRows ,$order);
			$this->assign('list',$list);
		}
		$this->display();
	}
	/**
	 * 查看分销商资金流水
	 * */
	function agentmoneyassets(){
		$condition=array();
		
        $sfield= $_REQUEST['sfield'];
		if ($sfield != 'all' && !empty ($sfield) && !empty ($this->keywords)){
			$condition[$sfield] = $this->keywords;
		}
		//科目条件查询
		$subject= $_REQUEST['subject'];
		if (!empty($subject)&&$subject!='all'){
			$condition['subject'] = $subject;
		}
		//资金变动类型条件查询
		$changtype= $_REQUEST['changtype'];
		if (!empty($changtype)&&$changtype!='all'){
			$condition['changtype'] = $changtype;
		}
		$this -> assign($_REQUEST);
		$order=$this->orderField.' '.$this->orderDirection;
		$totalRows = $this->money->assets_list($condition,'all');
		$this->assign ( "totalCount", $totalRows );
		if ($totalRows > 0) {
			$page = new Page ( $totalRows, $this->listrows );
			$pages=$page->show ();
			$list = $this->money->assets_list($condition,$page->firstRow . ',' . $page->listRows, $order);
			$this->assign('list',$list);
		}
		$this->display();
	}
	/**
	 * 给分销商充值XV
	 * */
	function toagentxv(){
		if ($_REQUEST ['dosubmit']) {
			$xv = floatval ( $_REQUEST ['xv'] );
			$remark = $_REQUEST ['remark'];
			$userid = intval ( $_REQUEST ['userid'] );
			if($xv<1){
				$this->_ajm(300,'充值不能小于1XV!',0);
			}
			if(empty($remark)){
				$this->_ajm(300,'请输入充值备注!',0);
			}
			$nowvalue = $this->money->recharge($userid,'XV',$xv,array(
	        	'action_userid'=>$this->userid,
	         	'cip'=>get_client_ip(),
	        	'bzvu'=>$remark,
	         	'changtype'=>'RECHARGE_XV'
	         	));
			if ($nowvalue!==false) {
				$this->_ajm(200,'充值成功!',0,U ( 'Kitmoney/agentmoney' ) );
			}else{
				$this->_ajm(300,'充值失败!',0);
			}
		}
		$this->display();
	}
	/**
	 * 分销商转帐充值XV
	 * */
	function agenttransferxv() {
		$map = array ();
		$status = $_REQUEST ['status'];
		$typeid = $_REQUEST ['typeid'];
		if ($status !== null && $status !== '') {
			$map ['status'] = $status;
		}
		if ($typeid !== null && $typeid !== '') {
			$map ['typeid'] = $typeid;
		}
		$sfield = $_REQUEST ['sfield'];
		if ($sfield == 'all') {
			$map = parent::create_where ( $map );
		} else {
			$map [$sfield] = $this->keywords;
		}
		$model = M ( 'KitAgentBankPay' );
		$count = $model->where ( $map )->count ();
		$list = array ();
		if ($count > 0) {
			$p = new Page ( $count, $this->listrows );
			//$order = 'createtime desc ';
			$list = $model->where ( $map )->order ( $this->order )->limit ( $p->firstRow . ',' . $p->listRows )->select ();
		}
		$this->assign ( 'list', $list );
		$this->assign ( 'totalCount', $count );
		$userid = array ();
		$user = M ( 'User' );
		foreach ( $list as $v ) {
			$userid [] = $v ['userid'];
		}
		$userid = implode ( ',', $userid );
		$userdata = $user->field ( 'id,username' )->where ( "id IN ({$userid})" )->select ();
		$this->assign ( 'userdata', field2key ( $userdata, 'id' ) );
		$status = array (
				'0' => '未处理',
				'1' => '处理中',
				'2' => '已处理完' 
		);
		$type = array (
				'0' => array (
						'msg' => '待核查...',
						'title' => '待核查' 
				),
				'1' => array (
						'msg' => '核查属实，等待操作入账。',
						'title' => '属实' 
				),
				'2' => array (
						'msg' => '暂无到账记录，等待次日核查。',
						'title' => '次日核查' 
				),
				'3' => array (
						'msg' => '无到账记录，关闭。',
						'title' => '无到账' 
				),
				'4' => array (
						'msg' => '重复提交,关闭。',
						'title' => '重复提交' 
				),
				'5' => array (
						'msg' => '核查属实，已操作入账，关闭。',
						'title' => '已入账' 
				) 
		);
		$this->assign ( 'status', $status );
		$this->assign ( 'type', $type );
		$this->assign ( 'map', $map );
		$this->assign ( 'sfield', $sfield );
		$this->display ();
	} // end payinfo
	/**
	 * 处理充值留言
	 */
	function pay() {
		$type = array (
				'0' => array (
						'msg' => '待核查...',
						'title' => '待核查' 
				),
				'1' => array (
						'msg' => '核查属实，等待操作入账。',
						'title' => '属实' 
				),
				'2' => array (
						'msg' => '暂无到账记录，等待次日核查。',
						'title' => '次日核查' 
				),
				'3' => array (
						'msg' => '无到账记录，关闭。',
						'title' => '无到账' 
				),
				'4' => array (
						'msg' => '重复提交,关闭。',
						'title' => '重复提交' 
				),
				'5' => array (
						'msg' => '核查属实，已操作入账，关闭。',
						'title' => '已入账' 
				) 
		);
		
		if ($_POST ['act'] == 'submit') {
			$typeid = intval ( $_POST ['type'] );
			$status = $typeid == 0 ? '0' : ($typeid == 1 || $typeid == 2) ? '1' : '2';
			$msg = Input::deleteHtmlTags ( $_POST ['msg'] );
			$id = intval ( $_REQUEST ['id'] );
			$data = array ();
			$dao = M ( "KitAgentBankPay" );
			$data = $dao->find ( $id );
			
			if ($data) {
				$content = unserialize ( $data ['reply_content'] );
				$content [] = array (
						'aid' => $this->userid,
						'time' => time (),
						'msg' => $type [$typeid] ['msg'] . '<br>' . $msg 
				);
				$vo = array ();
				$vo ['reply_content'] = serialize ( $content );
				$vo ['typeid'] = $typeid;
				$vo ['status'] = $status;
				$vo ['id'] = $data ['id'];
				$res = $dao->save ( $vo );
				if ($res === false) {
					$this->_ajm ( 300, '操作失败，请重试', 0 );
				} else {
					$this->_ajm ( 200, '数据修改成功！', 0, U ( 'Kitmoney/agenttransferxv' ) );
				}
				$this->_ajm ( 200, '数据修改成功！', 0, U ( 'Kitmoney/agenttransferxv' ) );
			} else {
				$this->_ajm ( 300, '操作的支付留言不存在', 0 );
			}
		} else {
			$status = array (
					'0' => '未处理',
					'1' => '处理中',
					'2' => '已处理完' 
			);
			$this->assign ( 'status', $status );
			$this->assign ( 'type', $type );
			$this->display ();
		}
	}
	/**
	 * 调整用户余额
	 */
	function money() {
		$user = $this->user->get_userinfo ( $_GET ['userid'], 'SMW01' );
		$user = array (
				'id' => $user ["user"] ['id'],
				'username' => $user ["user"] ['username'],
				'groupid' => $user ["role_user"] [0] ['role_id'] 
		);
		$model = M ( 'KitAgentBankPay' );
		$bankpay = $model->field ( "id,round(moneyprice/100) as moneyprice,kahao,liushuisn,status" )->find ( $_GET ['id'] );
		//$this->assign ( 'rlist', F ( 'Role' ) );
		$this->assign ( 'bankpay', $bankpay );
		$this->assign ( 'vo', $user );
		$this->display ();
	} // end money
	/**
	 * 调整用户资金
	 * 调整赠送帐户，记录赠送帐户信息
	 */
	function chumoney() {
		$user = M ( "User" );
		if (! $user->autoCheckToken ( $_POST )) {
			$this->_ajm ( 300, "请不要重复操作", 1, 'Kitmoney/agenttransferxv' );
			exit ();
		}
	
		$userid   = intval($_POST['userid']);
		$userinfo = $user->where()->find ($userid);
		$money    = M("KitAgentMoneyAuth");
		
		$bzvu     = $_POST['bzvu']; // 备注
		
		$czmoney = $_POST['czmoney']; //用户实际重回金额
	
		if($_POST['amount']<0 && empty($bzvu)){
			$this->_ajm(300,'进行扣款操作时备注信息不能为空!',0);
			exit();
		}
		
		// 查找授权码
		$where = array ();
		$data ['money_auth'] = $_POST ['auth_money_auth'];
		$data ['money_passwd'] = $_POST ['auth_money_passwd'];
		$data ['statu'] = array (
				"eq",
				0 
		);
		$data ['uid'] = array (
				'eq',
				0 
		);
		$data ['userid'] = array (
				'eq',
				0 
		);
		$auth = $money->where ( $data )->find ();
		
		if (! empty ( $auth )) {
			$oedu = unserialize ( $auth ['oedu'] );
			// 检查授权额度与充值额度是否相符
			if ($oedu ['amount'] == intval ( $_POST ['amount'] ) * 100) {
				$money->startTrans ();
				// $vo : 存储 user_money_auth 数据。
				$gvo = $vo = array ();
				$vo ['statu'] = 1;
				$vo ['mtime'] = time ();
				$vo ['uid'] = $this->userid;
				$vo ['userid'] = $userid;
				$vo ['id'] = $auth ['id'];
				
				$uvo = array (); // 用户更新数据
				$uvo ['userid'] = $userid;
				$uvo ['XV'] = $_POST ['amount'];
								
				$vo ['content'] = $auth ['content'];
				// 充值XV 操作
				if ($uvo ['XV']) {
					$urs = $nowvalue = $this->money->recharge ( $userid, 'XV', $uvo ['XV'], array (
							'action_userid' => $this->userid,
							'cip' => get_client_ip (),
							'bzvu' => $bzvu,
							'changtype' => 'ADMIN_ADD' 
					) );
				}
				// 修改授权码信息
				$rs = $money->save ( $vo );
				
				// 发送短信
				if ($rs && $urs) {
					//更改状态	 *****				
					$id = intval ( $_REQUEST ['id'] );
					$data = array ();
					$dao = M ( "KitAgentBankPay" );
					$data = $dao->find ( $id );
						
					if ($data) {
						$content = unserialize ( $data ['reply_content'] );
						$content [] = array (
								'aid' => $this->userid,
								'time' => time (),
								'msg' => '核查属实，已操作入账，关闭。' . '<br>' 
						);
						$vo = array ();
						$vo ['reply_content'] = serialize ( $content );
						$vo ['typeid'] = 5;
						$vo ['status'] = 2;
						$vo ['id'] = $data ['id'];
						$res = $dao->save ( $vo );
						if ($res === false) {
							$this->_ajm ( 300, '操作失败，请重试', 0 );
						} 
					} else {
						$this->_ajm ( 300, '操作的支付留言不存在', 0 );
					}					
					// end 更改状态	 *****
					
					// 账户余额
					$uprice = array ();
					$uprice ['XV'] = round ( $this->money->money_info ( $userid, 'SMW01', 'XV' ) ) / 100;
					
					// 构建短信信息
					$str = '您在' . date ( 'm月d日H时i分' ) . '充值' . $czmoney. 'XV 成功！已到账' .$czmoney . ' XV 。';
					
					$str .= '您 XV余额为：' . round ( $uprice ['XV']);
					$msg = iconv ( "UTF-8", "GB2312//TRANSLIT", $str );
					$dxinf = sendMobiMsg ( $userinfo ['user'] ['mobile'], $msg );
					
					$this->_ajm ( 200, '操作成功!', 0, U ( 'Kitmoney/agenttransferxv' ) );
				} else {
					$this->_ajm ( 300, '操作失败，请重试!', 0 );
				}
			} else {
				$this->_ajm ( 300, '“授权码授权金额”和“预付款金额”不一致！', 0 );
			}
		} else {
			$this->_ajm ( 300, '检查授权码或者授权密码错误，或授权码已用！', 0 );
		}
	}
	/**
	 * 授权码
	 */
	function authnum() {
		$map = array ();
		$status = $_REQUEST ['status'];
		if ($status === '0' || $status === '1') {
			$map ['statu'] = $status;
		}		
		$map = parent::create_where ( $map );
		
		$model = M ( 'KitAgentMoneyAuth' );
		$count = $model->where ( $map )->count ();
		$list = array ();
		if ($count > 0) {
			$p = new Page ( $count, $this->listrows );
			$list = $model->where ( $map )->order ( $this->order )->limit ( $p->firstRow . ',' . $p->listRows )->select ();
		}
		$this->assign ( 'list', $list );
		$this->assign ( 'totalCount', $count );
		$this->assign ( 'map', $map );
		$this->assign ( 'sfied', $sfield );
		$this->display ();
	}
	
	/**
	 * 查看授权码
	 */
	function authview() {
		$id = intval ( $_GET ['id'] );
		$dao = M ( "KitAgentMoneyAuth" );
		$vo = $dao->find ( $id );
		$this->assign ( 'vo', $vo );
		$this->display ();
	}
	/**
	 * 生产授权号与授权密码
	 */
	function cmoneyauth() {
		if(!empty($_POST['amount'])||!empty($_POST['give'])){
			$amount = intval($_POST['amount'])*100; // 金额转成分
			$give = intval($_POST['give'])*100; //赠送BV
			$oedu=serialize(array('amount'=>$amount,'give'=>$give));
			$authstr='Admin:'.$this->userid.'|Amount:'.$amount.'|Give:'.$_POST['give'];
			$time=time();
			$money_auth=short($authstr.$time);
			$money_passwd=short(md5($money_auth.$time));
			$dao=M("KitAgentMoneyAuth");
			if (!$dao->autoCheckToken($_POST)){
				$this->_ajm(300,'请不要重复操作',0);
			}
			$data = array ();
			$data ['ctime'] = $time;
			$data ['oedu'] = $oedu;
			$data ['content'] = $authstr;
			$data ['mtime'] = 0;
			$data ['money_auth'] = $money_auth;
			$data ['money_passwd'] = $money_passwd;
			$data ['statu'] = 0;
			$data ['aid'] = $this->userid;
			$data ['uid'] = 0;
			$data ['userid'] = 0;
			$data ['cip'] = get_client_ip ( 1 );
			$auth_id = $dao->add ( $data );
			if ($auth_id) {
				/*
				 * 还需要写入事件日志 logs 表
				 */
				$this->_ajm ( 200, '增加成功！', 0, U ( 'Kitmoney/authnum' ) );
			} else {
				/*
				 * 还需要写入事件日志 logs 表
				 */
				$this->_ajm ( 300, '操作错误，请重试', 0 );
			}
		} else {
			C ( 'TOKEN_ON', true );
			$this->display ();
		}
	}
	/**
	 * 作废授权码
	 */
	function statu() {
		$id = intval ( $_GET ['id'] );
		$dao = M ( "KitAgentMoneyAuth" );
		$vo = $dao->find ( $id );
		if ($vo ['statu'] != 0) {
			$this->_ajm ( 300, '只能作废未使用的授权', 0 );
		} elseif ($vo ['statu'] == 0) {
			$data = array ();
			$data ['statu'] = '3';
			$rs = $dao->where ( "id={$vo['id']} AND statu=0" )->save ( $data );
			if ($rs) {
				$this->_ajm ( 200, '操作成功!', 1, U ( 'Kitmoney/authnum' ) );
			} else {
				$this->_ajm ( 300, '操作失败，请重试!', 0 );
			}
		}
	}
	
	/**
	 * 申请TV提现
	 * */
	function tvtormb(){
		$map = array ();
		$status = $_REQUEST ['status'];
		$typeid = $_REQUEST ['typeid'];
		if ($status !== null && $status !== '') {
			$map ['status'] = $status;
		}
		if ($typeid !== null && $typeid !== '') {
			$map ['typeid'] = $typeid;
		}
		$sfield = $_REQUEST ['sfield'];
		if ($sfield == 'all') {
			$map = parent::create_where ( $map );
		} else {
			$map [$sfield] = $this->keywords;
		}
		$model = M ( 'KitAgentTvtormb' );
		$count = $model->where ( $map )->count ();
		$list = array ();
		if ($count > 0) {
			$p = new Page ( $count, $this->listrows );
			//$order = 'createtime desc ';
			$list = $model->where ( $map )->order ( $this->order )->limit ( $p->firstRow . ',' . $p->listRows )->select ();
		}
		$this->assign ( 'list', $list );
		$this->assign ( 'totalCount', $count );
		$userid = array ();
		$user = M ( 'User' );
		foreach ( $list as $v ) {
			$userid [] = $v ['userid'];
		}
		$userid = implode ( ',', $userid );
		$userdata = $user->field ( 'id,username' )->where ( "id IN ({$userid})" )->select ();
		$this->assign ( 'userdata', field2key ( $userdata, 'id' ) );
		$status = array (
				'0' => '未处理',
				'1' => '处理中',
				'2' => '已处理完' 
		);
		$type = array (
				'0' => array (
						'msg' => '待核查...',
						'title' => '待核查' 
				),
				'1' => array (
						'msg' => '核查属实，等待操作银行转账。',
						'title' => '属实' 
				),
				'2' => array (
						'msg' => '暂无可提现金额，等待次日核查。',
						'title' => '次日核查' 
				),
				'3' => array (
						'msg' => '无可提现金额，关闭。',
						'title' => '无提现金额' 
				),
				'4' => array (
						'msg' => '重复提交,关闭。',
						'title' => '重复提交' 
				),
				'5' => array (
						'msg' => '核查属实，已操作银行转账，关闭。',
						'title' => '已银行转账' 
				) 
		);
		$this->assign ( 'status', $status );
		$this->assign ( 'type', $type );
		$this->assign ( 'map', $map );
		$this->assign ( 'sfield', $sfield );
		$this->display ();
	}
	/**
	 * 处理提现留言
	 */
	function tvtormbpay() {
		$type = array (
				'0' => array (
						'msg' => '待核查...',
						'title' => '待核查' 
				),
				'1' => array (
						'msg' => '核查属实，等待操作银行转账。',
						'title' => '属实' 
				),
				'2' => array (
						'msg' => '暂无可提现金额，等待次日核查。',
						'title' => '次日核查' 
				),
				'3' => array (
						'msg' => '无可提现金额，关闭。',
						'title' => '无提现金额' 
				),
				'4' => array (
						'msg' => '重复提交,关闭。',
						'title' => '重复提交' 
				),
				'5' => array (
						'msg' => '核查属实，已操作银行转账，关闭。',
						'title' => '已银行转账' 
				) 
		);
		
		if ($_POST ['act'] == 'submit') {
			$typeid = intval ( $_POST ['type'] );
			$status = $typeid == 0 ? '0' : ($typeid == 1 || $typeid == 2) ? '1' : '2';
			$msg = Input::deleteHtmlTags ( $_POST ['msg'] );
			$id = intval ( $_REQUEST ['id'] );
			$data = array ();
			$dao = M ( "KitAgentTvtormb" );
			$data = $dao->find ( $id );
			
			if ($data) {
				$content = unserialize ( $data ['reply_content'] );
				$content [] = array (
						'aid' => $this->userid,
						'time' => time (),
						'msg' => $type [$typeid] ['msg'] . '<br>' . $msg 
				);
				$vo = array ();
				$vo ['reply_content'] = serialize ( $content );
				$vo ['typeid'] = $typeid;
				$vo ['status'] = $status;
				$vo ['id'] = $data ['id'];
				$res = $dao->save ( $vo );
				if ($res === false) {
					$this->_ajm ( 300, '操作失败，请重试', 0 );
				} else {
					$this->_ajm ( 200, '数据修改成功！', 0, U ( 'Kitmoney/tvtormb' ) );
				}
				$this->_ajm ( 200, '数据修改成功！', 0, U ( 'Kitmoney/tvtormb' ) );
			} else {
				$this->_ajm ( 300, '操作的提现留言不存在', 0 );
			}
		} else {
			$status = array (
					'0' => '未处理',
					'1' => '处理中',
					'2' => '已处理完' 
			);
			$this->assign ( 'status', $status );
			$this->assign ( 'type', $type );
			$this->display ();
		}
	}
	/**
	 * 调整提现用户余额
	 */
	function tvtormbmoney() {
		$user = $this->user->get_userinfo ( $_GET ['userid'], 'SMW01' );
		$user = array (
				'id' => $user ["user"] ['id'],
				'username' => $user ["user"] ['username'],
				'groupid' => $user ["role_user"] [0] ['role_id'] 
		);
		$model = M ( 'KitAgentTvtormb' );
		$bankpay = $model->field ( "id,round(moneyprice/100) as moneyprice,kahao,liushuisn,status" )->find ( $_GET ['id'] );
		//$this->assign ( 'rlist', F ( 'Role' ) );
		$this->assign ( 'bankpay', $bankpay );
		$this->assign ( 'vo', $user );
		$this->display ();
	} // end money
	/**
	 * 调整提现用户资金
	 */
	function tvtormbchumoney() {
		$user = M ( "User" );
		if (! $user->autoCheckToken ( $_POST )) {
			$this->_ajm ( 300, "请不要重复操作", 1, 'Kitmoney/tvtormb' );
			exit ();
		}
	
		$userid   = intval($_POST['userid']);
		$userinfo = $user->where()->find ($userid);
		
		$liushuisn     = $_POST['liushuisn']; // 备注
		
		$bzvu     = $_POST['bzvu']; // 备注
		
		$czmoney = intval($_POST['czmoney']); //用户实际重回金额
	
		if($_POST['amount']<0 && empty($bzvu) && empty($liushuisn)){
			$this->_ajm(300,'进行转款操作时备注信息和转帐银行流水不能为空!',0);
			exit();
		}
		
		if ( $czmoney == intval( $_POST ['amount'] )) {
			$uvo = array (); // 用户更新数据
			$uvo ['userid'] = $userid;
			$uvo ['TV'] = intval($_POST ['amount']);
			
			// 扣除TV 操作
			if ($uvo ['TV']) {
				$urs = $nowvalue = $this->money->recharge ( $userid, 'TV', $uvo ['TV'], array (
						'action_userid' => $this->userid,
						'cip' => get_client_ip (),
						'bzvu' => $bzvu,
						'changtype' => 'TVTORMB',
						'oper' => '-'
				) );
			}
			// 发送短信
			if ($urs) {
				//更改状态	 *****				
				$id = intval ( $_REQUEST ['id'] );
				$data = array ();
				$dao = M ( "KitAgentTvtormb" );
				$data = $dao->find ( $id );
					
				if ($data) {
					$content = unserialize ( $data ['reply_content'] );
					$content [] = array (
							'aid' => $this->userid,
							'time' => time (),
							'msg' => '核查属实，已操作银行转帐，关闭。' . '<br>' 
					);
					$vo = array ();
					$vo ['reply_content'] = serialize ( $content );
					$vo ['liushuisn'] = $liushuisn;
					$vo ['typeid'] = 5;
					$vo ['status'] = 2;
					$vo ['id'] = $data ['id'];
					$res = $dao->save ( $vo );
					if ($res === false) {
						$this->_ajm ( 300, '操作失败，请重试', 0 );
					} 
				} else {
					$this->_ajm ( 300, '操作的提现留言不存在', 0 );
				}					
				// end 更改状态	 *****
				
				// 账户余额
				$uprice = array ();
				$uprice ['TV'] = round ( $this->money->money_info ( $userid, 'SMW01', 'TV' ) ) / 100;
				
				// 构建短信信息
				$str = '您在' . date ( 'm月d日H时i分' ) . '提现' . $czmoney. '元 成功！已银行转帐' .$czmoney . ' 元 。';
				
				$str .= '您 TV余额为：' . round ( $uprice ['TV']);
				$msg = iconv ( "UTF-8", "GB2312//TRANSLIT", $str );
				$dxinf = sendMobiMsg ( $userinfo ['user'] ['mobile'], $msg );
				
				$this->_ajm ( 200, '操作成功!', 0, U ( 'Kitmoney/tvtormb' ) );
			} else {
				$this->_ajm ( 300, '请查看当前用户TV，操作失败，请重试!', 0 );
			}
		} else {
			$this->_ajm ( 300, '“提现金额”和“银行转帐金额”不一致！', 0 );
		}
	}
	/**
	 * 查看销售套件资金
	 * */
	function kitselltv(){
		
	}
	/**
	 * 查看套件资金预算
	 * */
	function allkitmoney(){
		
	}
	/**
	 * 查看区域订单结算
	 * */
	function aaoc(){
		
	}
}